package com.cloudpivot.receivales.contract.repository.bpm;

import com.cloudpivot.receivales.contract.entity.bpmcontract.BpmContractV3Entity;
import com.cloudpivot.receivales.contract.entity.erpcontract.Inventory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface BpmContractRepository extends JpaRepository<BpmContractV3Entity,String> {

    /**
     * 获取bpm的合同对象
     * @param id
     * @return
     */
    @Query(nativeQuery = true, value = "select * from izch0_newcuscontract where id = :id")
    BpmContractV3Entity getBpmContract(@Param(value = "id") String id);

    /**
     * 获取bpm数据库中 id对应的部门名称
     * @param id
     * @return
     */
    @Query(nativeQuery = true, value = "select name from h_org_department where id=:id limit 1")
    String getBpmDeptName(@Param(value = "id") String id);

    /**
     * 获取人员名称
     * @param id
     * @return
     */
    @Query(nativeQuery = true, value = "select name from h_org_user where id=:id limit 1")
    String getBpmUserName(@Param(value = "id") String id);

}
